ke = {}
    , we = {}
    , Ce = 16
    , Se = 65536
    , Pe = 65535;
let Ie, Te, Ae, Ee;
const De = function(e) {
    this.digits = "boolean" === typeof e && !0 === e ? null : Te.slice(0),
        this.isNeg = !1
};
function Ne(e) {
    const t = we
        , i = t.biDivideByRadixPower(e, this.k - 1)
        , n = t.biMultiply(i, this.mu)
        , o = t.biDivideByRadixPower(n, this.k + 1)
        , r = t.biModuloByRadixPower(e, this.k + 1)
        , a = t.biMultiply(o, this.modulus)
        , s = t.biModuloByRadixPower(a, this.k + 1);
    let l = t.biSubtract(r, s);
    l.isNeg && (l = t.biAdd(l, this.bkplus1));
    let d = t.biCompare(l, this.modulus) >= 0;
    for (; d; )
        l = t.biSubtract(l, this.modulus),
            d = t.biCompare(l, this.modulus) >= 0;
    return l
}
function Me(e, t) {
    const i = we.biMultiply(e, t);
    return this.modulo(i)
}
function Le(e, t) {
    let i = new De;
    i.digits[0] = 1;
    let n = e
        , o = t;
    for (; o && (0 != (1 & o.digits[0]) && (i = this.multiplyMod(i, n)),
        o = we.biShiftRight(o, 1),
    0 != o.digits[0] || 0 != we.biHighIndex(o)); )
        n = this.multiplyMod(n, n);
    return i
}
ke.BarrettMu = function(e) {
    this.modulus = we.biCopy(e),
        this.k = we.biHighIndex(this.modulus) + 1;
    const t = new De;
    t.digits[2 * this.k] = 1,
        this.mu = we.biDivide(t, this.modulus),
        this.bkplus1 = new De,
        this.bkplus1.digits[this.k + 1] = 1,
        this.modulo = Ne,
        this.multiplyMod = Me,
        this.powMod = Le
}
    ,
    we.biModuloByRadixPower = function(e, t) {
        const i = new De;
        return we.arrayCopy(e.digits, 0, i.digits, 0, t),
            i
    }
    ,
    we.biMultiply = function(e, t) {
        const i = new De;
        let n;
        const o = we.biHighIndex(e)
            , r = we.biHighIndex(t);
        let a, s;
        for (let l = 0; l <= r; ++l) {
            n = 0,
                s = l;
            for (let r = 0; r <= o; ++r,
                ++s)
                a = i.digits[s] + e.digits[r] * t.digits[l] + n,
                    i.digits[s] = a & Pe,
                    n = a >>> 16;
            i.digits[l + o + 1] = n
        }
        return i.isNeg = e.isNeg != t.isNeg,
            i
    }
    ,
    we.biDivideByRadixPower = function(e, t) {
        const i = new De;
        return we.arrayCopy(e.digits, t, i.digits, 0, i.digits.length - t),
            i
    }
    ,
    we.biDivide = function(e, t) {
        return we.biDivideModulo(e, t)[0]
    }
    ,
    we.setMaxDigits = function(e) {
        Ie = e,
            Te = new Array(Ie);
        for (let t = 0; t < Te.length; t++)
            Te[t] = 0;
        Ae = new De,
            Ee = new De,
            Ee.digits[0] = 1
    }
    ,
    we.setMaxDigits(20),
    we.biCopy = function(e) {
        const t = new De(!0);
        return t.digits = e.digits.slice(0),
            t.isNeg = e.isNeg,
            t
    }
    ,
    we.reverseStr = function(e) {
        let t = "";
        for (let i = e.length - 1; i > -1; --i)
            t += e.charAt(i);
        return t
    }
;
const Be = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
we.biToString = function(e, t) {
    const i = new De;
    i.digits[0] = t;
    let n = we.biDivideModulo(e, i)
        , o = Be[n[1].digits[0]];
    for (; 1 == we.biCompare(n[0], Ae); )
        n = we.biDivideModulo(n[0], i),
            o += Be[n[1].digits[0]];
    return (e.isNeg ? "-" : "") + we.reverseStr(o)
}
;
const je = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
we.digitToHex = function(e) {
    let t = "";
    for (let i = 0; i < 4; ++i)
        t += je[15 & e],
            e >>>= 4;
    return we.reverseStr(t)
}
    ,
    we.biToHex = function(e) {
        let t = "";
        we.biHighIndex(e);
        for (let i = we.biHighIndex(e); i > -1; --i)
            t += we.digitToHex(e.digits[i]);
        return t
    }
    ,
    we.charToHex = function(e) {
        let t;
        return t = e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 90 ? 10 + e - 65 : e >= 97 && e <= 122 ? 10 + e - 97 : 0,
            t
    }
    ,
    we.hexToDigit = function(e) {
        let t = 0;
        const i = Math.min(e.length, 4);
        for (let n = 0; n < i; ++n)
            t <<= 4,
                t |= we.charToHex(e.charCodeAt(n));
        return t
    }
    ,
    we.biFromHex = function(e) {
        const t = new De;
        for (let i = e.length, n = 0; i > 0; i -= 4,
            ++n)
            t.digits[n] = we.hexToDigit(e.substr(Math.max(i - 4, 0), Math.min(i, 4)));
        return t
    }
    ,
    we.biAdd = function(e, t) {
        let i;
        if (e.isNeg != t.isNeg)
            t.isNeg = !t.isNeg,
                i = we.biSubtract(e, t),
                t.isNeg = !t.isNeg;
        else {
            i = new De;
            let n, o = 0;
            for (let r = 0; r < e.digits.length; ++r)
                n = e.digits[r] + t.digits[r] + o,
                    i.digits[r] = n % Se,
                    o = Number(n >= Se);
            i.isNeg = e.isNeg
        }
        return i
    }
    ,
    we.biSubtract = function(e, t) {
        let i;
        if (e.isNeg != t.isNeg)
            t.isNeg = !t.isNeg,
                i = we.biAdd(e, t),
                t.isNeg = !t.isNeg;
        else {
            let n, o;
            i = new De,
                o = 0;
            for (let r = 0; r < e.digits.length; ++r)
                n = e.digits[r] - t.digits[r] + o,
                    i.digits[r] = n % Se,
                i.digits[r] < 0 && (i.digits[r] += Se),
                    o = 0 - Number(n < 0);
            if (-1 == o) {
                o = 0;
                for (let t = 0; t < e.digits.length; ++t)
                    n = 0 - i.digits[t] + o,
                        i.digits[t] = n % Se,
                    i.digits[t] < 0 && (i.digits[t] += Se),
                        o = 0 - Number(n < 0);
                i.isNeg = !e.isNeg
            } else
                i.isNeg = e.isNeg
        }
        return i
    }
    ,
    we.biHighIndex = function(e) {
        let t = e.digits.length - 1;
        for (; t > 0 && 0 == e.digits[t]; )
            --t;
        return t
    }
    ,
    we.biNumBits = function(e) {
        const t = we.biHighIndex(e);
        let i = e.digits[t];
        const n = (t + 1) * Ce;
        let o;
        for (o = n; o > n - Ce && 0 == (32768 & i); --o)
            i <<= 1;
        return o
    }
    ,
    we.biMultiplyDigit = function(e, t) {
        let i, n, o;
        const r = new De;
        i = we.biHighIndex(e),
            n = 0;
        for (let a = 0; a <= i; ++a)
            o = r.digits[a] + e.digits[a] * t + n,
                r.digits[a] = o & Pe,
                n = o >>> 16;
        return r.digits[1 + i] = n,
            r
    }
    ,
    we.arrayCopy = function(e, t, i, n, o) {
        const r = Math.min(t + o, e.length);
        for (let a = t, s = n; a < r; ++a,
            ++s)
            i[s] = e[a]
    }
;
const Re = [0, 32768, 49152, 57344, 61440, 63488, 64512, 65024, 65280, 65408, 65472, 65504, 65520, 65528, 65532, 65534, 65535];
we.biShiftLeft = function(e, t) {
    const i = Math.floor(t / Ce)
        , n = new De;
    we.arrayCopy(e.digits, 0, n.digits, i, n.digits.length - i);
    const o = t % Ce
        , r = Ce - o;
    let a = n.digits.length - 1
        , s = a - 1;
    for (; a > 0; --a,
        --s)
        n.digits[a] = n.digits[a] << o & Pe | (n.digits[s] & Re[o]) >>> r;
    return n.digits[0] = n.digits[a] << o & Pe,
        n.isNeg = e.isNeg,
        n
}
;
const Oe = [0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535];
we.biShiftRight = function(e, t) {
    const i = Math.floor(t / Ce)
        , n = new De;
    we.arrayCopy(e.digits, i, n.digits, 0, e.digits.length - i);
    const o = t % Ce
        , r = Ce - o;
    for (let a = 0, s = a + 1; a < n.digits.length - 1; ++a,
        ++s)
        n.digits[a] = n.digits[a] >>> o | (n.digits[s] & Oe[o]) << r;
    return n.digits[n.digits.length - 1] >>>= o,
        n.isNeg = e.isNeg,
        n
}
    ,
    we.biMultiplyByRadixPower = function(e, t) {
        const i = new De;
        return we.arrayCopy(e.digits, 0, i.digits, t, i.digits.length - t),
            i
    }
    ,
    we.biCompare = function(e, t) {
        if (e.isNeg != t.isNeg)
            return 1 - 2 * Number(e.isNeg);
        for (let i = e.digits.length - 1; i >= 0; --i)
            if (e.digits[i] != t.digits[i])
                return e.isNeg ? 1 - 2 * Number(e.digits[i] > t.digits[i]) : 1 - 2 * Number(e.digits[i] < t.digits[i]);
        return 0
    }
    ,
    we.biDivideModulo = function(e, t) {
        let i = we.biNumBits(e)
            , n = we.biNumBits(t);
        const o = t.isNeg;
        let r, a;
        if (i < n)
            return e.isNeg ? (r = we.biCopy(Ee),
                r.isNeg = !t.isNeg,
                e.isNeg = !1,
                t.isNeg = !1,
                a = we.biSubtract(t, e),
                e.isNeg = !0,
                t.isNeg = o) : (r = new De,
                a = we.biCopy(e)),
                [r, a];
        r = new De,
            a = e;
        let s = Math.ceil(n / Ce) - 1
            , l = 0;
        for (; t.digits[s] < 32768; )
            t = we.biShiftLeft(t, 1),
                ++l,
                ++n,
                s = Math.ceil(n / Ce) - 1;
        a = we.biShiftLeft(a, l),
            i += l;
        const d = Math.ceil(i / Ce) - 1;
        let c = we.biMultiplyByRadixPower(t, d - s);
        for (; -1 != we.biCompare(a, c); )
            ++r.digits[d - s],
                a = we.biSubtract(a, c);
        for (let u = d; u > s; --u) {
            const e = u >= a.digits.length ? 0 : a.digits[u]
                , i = u - 1 >= a.digits.length ? 0 : a.digits[u - 1]
                , n = u - 2 >= a.digits.length ? 0 : a.digits[u - 2]
                , o = s >= t.digits.length ? 0 : t.digits[s]
                , l = s - 1 >= t.digits.length ? 0 : t.digits[s - 1];
            r.digits[u - s - 1] = e == o ? Pe : Math.floor((e * Se + i) / o);
            let d = r.digits[u - s - 1] * (o * Se + l)
                , p = 4294967296 * e + (i * Se + n);
            for (; d > p; )
                --r.digits[u - s - 1],
                    d = r.digits[u - s - 1] * (o * Se | l),
                    p = e * Se * Se + (i * Se + n);
            c = we.biMultiplyByRadixPower(t, u - s - 1),
                a = we.biSubtract(a, we.biMultiplyDigit(c, r.digits[u - s - 1])),
            a.isNeg && (a = we.biAdd(a, c),
                --r.digits[u - s - 1])
        }
        return a = we.biShiftRight(a, l),
            r.isNeg = e.isNeg != o,
        e.isNeg && (r = o ? we.biAdd(r, Ee) : we.biSubtract(r, Ee),
            t = we.biShiftRight(t, l),
            a = we.biSubtract(t, a)),
        0 == a.digits[0] && 0 == we.biHighIndex(a) && (a.isNeg = !1),
            [r, a]
    }
;
const Fe = function(e, t, i) {
    const n = we;
    this.e = n.biFromHex(e),
        this.d = n.biFromHex(t),
        this.m = n.biFromHex(i),
        this.chunkSize = 2 * n.biHighIndex(this.m),
        this.radix = 16,
        this.barrett = new ke.BarrettMu(this.m)
};
we.getKeyPair = function(e, t, i) {
    return new Fe(e,t,i)
}
    ,
    we.encryptedString = function(e, t) {
        const i = []
            , n = t.length;
        let o = 0;
        for (; o < n; )
            i[o] = t.charCodeAt(o),
                o++;
        for (; i.length % e.chunkSize != 0; )
            i[o++] = 0;
        const r = i.length;
        let a, s, l, d = "";
        for (o = 0; o < r; o += e.chunkSize) {
            for (l = new De,
                     a = 0,
                     s = o; s < o + e.chunkSize; ++a)
                l.digits[a] = i[s++],
                    l.digits[a] += i[s++] << 8;
            const t = e.barrett.powMod(l, e.e);
            d += (16 == e.radix ? we.biToHex(t) : we.biToString(t, e.radix)) + " "
        }
        return d.substring(0, d.length - 1)
    }
    ,
    we.setMaxDigits(130);
    qe = {
    createSign(e, t, i, n) {
        let o = Object.keys(e).sort().map((t => {
                var i;
                return "".concat(t, "=").concat(null !== (i = e[t]) && void 0 !== i ? i : "")
            }
        )).join("&");
        t = t || "key",
            i = i || "2cCq2fgeDNG-Eb8B%d]S.Ch<c]@uVN95",
            o = "".concat(o, "&").concat(t, "=").concat(i);
        const r = k()(o);
        return n ? r.toUpperCase() : r.toLowerCase()
    },
    createSignLike(e) {
        let t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "X2HZpj6R04Lz7srW"
            , i = Object.keys(e).sort().map((t => {
                var i;
                return "".concat(t, "=").concat(null !== (i = e[t]) && void 0 !== i ? i : "")
            }
        )).join("&");
        return i = "".concat(i).concat(t),
            qe.getQdsf(i)
    },
    createSignPca: e => qe.createSign(e, "secret_key", "howcuteitis", !0)}

var rsaEnc = function(e) {
    const t = we.getKeyPair("10001", "", "ab86b6371b5318aaa1d3c9e612a9f1264f372323c8c0f19875b5fc3b3fd3afcc1e5bec527aa94bfa85bffc157e4245aebda05389a5357b75115ac94f074aefcd");
    return we.encryptedString(t, encodeURIComponent(e)).replace(/\s/g, "-")
}

console.log(rsaEnc("123123"))


// 9ce503ecc7ef860dffaa0907bea7b09f8fe5ccb76d7924a8f066fbd5913572656a7b69b728b9685673d8f3401fbdf770f7536b5c2f033b71d54f16b7ccc98d8b

// 9ce503ecc7ef860dffaa0907bea7b09f8fe5ccb76d7924a8f066fbd5913572656a7b69b728b9685673d8f3401fbdf770f7536b5c2f033b71d54f16b7ccc98d8b